import request from '@/utils/request'

// 获取教师列表
export function getTeacherList(data) {
  return request({
    url: '/teacher/list',
    method: 'post',
    data
  })
}

// 获取教师选项（用于下拉选择）
export function getTeacherOptions() {
  return request({
    url: '/teacher/options',
    method: 'get'
  })
}

// 获取教师审核列表
export function getTeacherReviewList(params) {
  return request({
    url: '/teacher/review/list',
    method: 'get',
    params
  })
}

// 审核通过
export function approveTeacher(id) {
  return request({
    url: `/teacher/review/${id}/approve`,
    method: 'put'
  })
}

// 审核拒绝
export function rejectTeacher(data) {
  return request({
    url: `/teacher/review/${data.id}/reject`,
    method: 'put',
    data: {
      reason: data.reason
    }
  })
}

// 新增教师
export function addTeacher(data) {
  return request({
    url: '/teacher/add',
    method: 'post',
    data
  })
}

// 更新教师
export function updateTeacher(data) {
  return request({
    url: `/teacher/${data.id}`,
    method: 'put',
    data
  })
}

// 删除教师
export function deleteTeacher(id) {
  return request({
    url: `/teacher/${id}`,
    method: 'delete'
  })
}

// 切换教师状态
export function toggleTeacherStatus(id) {
  return request({
    url: `/teacher/${id}/toggle-status`,
    method: 'put'
  })
}

// 获取教师审核统计数据
export function getTeacherReviewStats() {
  return request({
    url: '/teacher/review/stats',
    method: 'get'
  })
}

// 获取教师审核详情
export function getTeacherReviewDetail(id) {
  return request({
    url: `/teacher/review/${id}/detail`,
    method: 'get'
  })
}

// 导出教师审核数据为Excel
export function exportTeacherReviewData(params) {
  return request({
    url: '/teacher/review/export',
    method: 'get',
    params: params,
    responseType: 'blob'
  })
}
